home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / unix / src / _setjmp.asm < prev    next >
Encoding:
Assembly Source File  |  1992-08-15  |  486 b   |  24 lines

  1.     XDEF    __setjmp
  2.     XDEF    __longjmp
  3.     
  4.     csect    text,0,,2,2
  5.  
  6. __setjmp:
  7.     move.l    4(a7),a0        ; Get jmp_buf
  8.     move.l    (a7),(a0)+        ; Save return address
  9.     movem.l    a2-a7/d2-d7,(a0)    ; Save registers
  10.     moveq    #0,d0
  11.     rts
  12.  
  13. __longjmp:
  14.     move.l    4(a7),a0        ; Get jmp_buf
  15.     move.l    8(a7),d0        ; Get result
  16.     bne.s    ok
  17.     moveq    #1,d0            ; Return must be != 0
  18. ok    move.l    (a0)+,a1        ; Get return address
  19.     movem.l    (a0),a2-a7/d2-d7    ; Get registers
  20.     addq.l    #4,a7            ; Pop return address
  21.     jmp    (a1)            ; And return to setjmp call
  22.  
  23.     end
  24.